<%@page import="java.util.List"%>
<%@page import="com.zhiyou.util.UserUtil"%>
<%@page import="com.zhiyou.entities.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
此页面实现更新数据
<%
	request.setCharacterEncoding("utf-8");
	response.setCharacterEncoding("utf-8");
	UserUtil util=new UserUtil();
	String sid=request.getParameter("id");
	int id=Integer.parseInt(sid);
	String name=request.getParameter("username");
	String pwd=request.getParameter("pwd");
	//调用方法实现更新
	User user=new User(id,name,pwd);
	int i=util.updateUserById(user);
	if(i>0){//成功
		List<User> list=util.getAllUsers();
		//把数据放到session中
		session.setAttribute("list", list);
		response.sendRedirect("info.jsp");
	}else{//失败
		response.sendRedirect("error.jsp");
	}
%>
</body>
</html>